class Solution:
    def findPeakElement(self, nums) -> int:
        if len(nums) <= 1:
            return 0
        for i in range(0, len(nums), 2):
            if i == len(nums) - 1:
                if nums[i] > nums[i-1]:
                    return i
            if nums[i] > nums[i+1]:
                if i == 0:
                    return 0
                else:
                    if nums[i] > nums[i-1]:
                        return i
            else:
                if i + 1 == len(nums)-1:
                    return i + 1
                else:
                    if nums[i+1] > nums[i+2]:
                        return i + 1

if __name__ == '__main__':
    so = Solution()
    s = [1,2,3]
    r = so.findPeakElement(s)
    print(r)
